/*
 * @Author: anxia.ack anchenkai@come-future.com
 * @Date: 2025-04-20 09:42:42
 * @LastEditors: anxia.ack anchenkai@come-future.com
 * @LastEditTime: 2025-04-20 14:47:09
 * @FilePath: /free-learning-front/src/api/review.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import request, { post, put } from "@/utils/request";

const BASE_URL = "/api/v1/course/review";
export interface CourseReview {
  id: number;
  courseId: number;
  courseName: string;
  userId: number;
  consultantId: number;
  consultantName: string;
  rating: number;
  comment: string;
  reviewTime: string;
  nickName: string;
  avatar: string;
  status: number;
  likeCount: number;
  auditInfo: string;
}

export interface CourseReviewPageQuery {
  keyword: string;
  courseId: number;
  status: number;
  consultantId: number;
  userId: number;
  pageNum: number;
  pageSize: number;
}
export const page = (
  courseReviewPageQuery: Partial<CourseReviewPageQuery>
): Promise<PageResult<CourseReview[]>> => {
  return post(`${BASE_URL}/page`, courseReviewPageQuery);
};
export const add = (courseReview: CourseReview): Promise<boolean> => {
  return post(`${BASE_URL}/add`, courseReview);
};
export const deleteById = (id: number): Promise<boolean> => {
  return request.delete(`${BASE_URL}/delete/${id}`);
};
export const update = (courseReview: CourseReview): Promise<boolean> => {
  return put(`${BASE_URL}/update`, courseReview);
};

export interface CourseReviewLike {
  id: number;
  reviewId: number;
  userId: number;
  createTime: string;
}

export const like = (courseReviewLike: CourseReviewLike): Promise<boolean> => {
  return post(`${BASE_URL}/like`, courseReviewLike);
};


  